<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Freetype OpenGL: Vertex attribute</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="style.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="content"><!-- do not remove this div! -->

<div id="top"><!-- do not remove this div! -->

  
  <div id="titlearea">
    
    <div id="projectname">Freetype OpenGL</div>
    
    
    <div id="projectbrief">A high quality OpenGL text rendering engine for C</div>
    
  </div>
  

<!--

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Freetype OpenGL
   &#160;<span id="projectnumber">0.1</span>
   </div>
   <div id="projectbrief">A high quality OpenGL text rendering engine for C</div>
  </td>
  
  
  
   
  
 </tr>
 </tbody>
</table>
</div>
-->


<!-- Generated by Doxygen 1.8.0 -->
<script type="text/javascript" src="dynsections.js"></script>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Defines</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Vertex attribute</div>  </div>
</div><!--header-->
<div class="contents">
<hr/><a name="details" id="details"></a><h2>Synopsis</h2>
<p>Besides the required vertex position, vertices can have several other numeric attributes. </p>
<p>Each is specified in the format string with a letter, the number of components and the data type.</p>
<p>Each of the attributes is described in the table below with the set of valid format strings written as a regular expression (for example, "v[234][if]" means "v2f", "v3i", "v4f", etc. are all valid formats).</p>
<p>Some attributes have a "recommended" format string, which is the most efficient form for the video driver as it requires less conversion.</p>
<table class="doxtable">
<tr>
<th>Attribute </th><th>Formats </th><th>Recommended  </th></tr>
<tr>
<td>Vertex position </td><td>"v[234][sifd]" </td><td>"v[234]f"  </td></tr>
<tr>
<td>Color  </td><td>"c[34][bBsSiIfd]"  </td><td>"c[34]B"   </td></tr>
<tr>
<td>Edge flag  </td><td>"e1[bB]"  </td><td></td></tr>
<tr>
<td>Fog coordinate  </td><td>"f[1234][bBsSiIfd]" </td><td></td></tr>
<tr>
<td>Normal  </td><td>"n3[bsifd]"  </td><td>"n3f"   </td></tr>
<tr>
<td>Secondary color  </td><td>"s[34][bBsSiIfd]"  </td><td>"s[34]B"   </td></tr>
<tr>
<td>Texture coordinate  </td><td>"t[234][sifd]"  </td><td>"t[234]f"   </td></tr>
<tr>
<td>Generic attribute  </td><td>"[0-15]g(n)?[1234][bBsSiIfd]"  </td><td></td></tr>
</table>
<p>The possible data types that can be specified in the format string are described below.</p>
<table class="doxtable">
<tr>
<th>Format  </th><th>Type  </th><th>GL Type   </th></tr>
<tr>
<td>"b"  </td><td>Signed byte  </td><td>GL_BYTE   </td></tr>
<tr>
<td>"B"  </td><td>Unsigned byte  </td><td>GL_UNSIGNED_BYTE   </td></tr>
<tr>
<td>"s"  </td><td>Signed short  </td><td>GL_SHORT   </td></tr>
<tr>
<td>"S"  </td><td>Unsigned short  </td><td>GL_UNSIGNED_SHORT   </td></tr>
<tr>
<td>"i"  </td><td>Signed int  </td><td>GL_INT   </td></tr>
<tr>
<td>"I"  </td><td>Unsigned int  </td><td>GL_UNSIGNED_INT   </td></tr>
<tr>
<td>"f"  </td><td>Float  </td><td>GL_FLOAT   </td></tr>
<tr>
<td>"d"  </td><td>Double  </td><td>GL_DOUBLE T   </td></tr>
</table>
<p>The following attributes are normalised to the range [0, 1]. The value is used as-is if the data type is floating-point. If the data type is byte, short or int, the value is divided by the maximum value representable by that type. For example, unsigned bytes are divided by 255 to get the normalised value.</p>
<ul>
<li>Color<ul>
<li>Secondary color</li>
<li>Generic attributes with the "n" format given.</li>
</ul>
</li>
</ul>
<p>Up to 16 generic attributes can be specified per vertex, and can be used by shader programs for any purpose (they are ignored in the fixed-function pipeline). For the other attributes, consult the OpenGL programming guide for details on their effects.</p>
<p>When using the draw and related functions, attribute data is specified alongside the vertex position data. The following example reproduces the two points from the previous page, except that the first point is blue and the second green:</p>
<p>It is an error to provide more than one set of data for any attribute, or to mismatch the size of the initial data with the number of vertices specified in the first argument. </p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structvertex__attribute__t.html">vertex_attribute_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generic vertex attribute.  <a href="structvertex__attribute__t.html#details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr class="memitem:ga9555c2d7b2932a0f83629c11fd863c7a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga9555c2d7b2932a0f83629c11fd863c7a"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vertex-attribut.html#ga9555c2d7b2932a0f83629c11fd863c7a">MAX_VERTEX_ATTRIBUTE</a>&#160;&#160;&#160;16</td></tr>
<tr class="memdesc:ga9555c2d7b2932a0f83629c11fd863c7a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Maximum number of attributes per vertex. <br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gae82d3ebbe275f575db72a23848a56e8d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vertex-attribut.html#gae82d3ebbe275f575db72a23848a56e8d">vertex_attribute_delete</a> (<a class="el" href="structvertex__attribute__t.html">vertex_attribute_t</a> *self)</td></tr>
<tr class="memdesc:gae82d3ebbe275f575db72a23848a56e8d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete a vertex attribute.  <a href="#gae82d3ebbe275f575db72a23848a56e8d"></a><br/></td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="gae82d3ebbe275f575db72a23848a56e8d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="group__vertex-attribut.html#gae82d3ebbe275f575db72a23848a56e8d">vertex_attribute_delete</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structvertex__attribute__t.html">vertex_attribute_t</a> *&#160;</td>
          <td class="paramname"><em>self</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Delete a vertex attribute. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>a vertex attribute </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div>
</body>
</html>
